package model.potentialField;

import java.awt.Point;

public class GoalLayer extends Layer{
	public GoalLayer(int width, int height){
		super(width,height);
	}
	

	@Override
	void calculatePf() {
		// Set all goals and blocks in the potential Field

		clear(potentialField);
		for(int i = 0; i < this.width; i++){
			for(int j = 0; j < this.height; j++){
				// Set all goals
				for(int k = 0; k < this.elements.size(); k++){
					Point point = this.elements.get(k);
					if(Math.abs(point.x - i) < Math.abs(point.y - j)){
						potentialField[i][j] += Math.abs(point.y - j);
					}else{
						potentialField[i][j] += Math.abs(point.x - i);
					}
				}
			}
		}

	}
}
